package alg20241218;

public class Text {
    public int maxArea(int[] height) {
        int n = height.length;
        int maxarea = 0;
        for (int left = 0, right = n - 1; left < right; ) {
            int area = (right - left) * Math.min(height[left], height[right]);
            maxarea = Math.max(maxarea, area);
            if(height[left] < height[right]) left++;
            else right--;
        }
        return maxarea;
    }
}
